/**
 * @author Fang Lu, fanglupku@gmail.com
 * 2011-4-15
 */
package dao.filter;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.HashMap;

import dao.PageDao;

public class PageFilter {
	public static ArrayList<Integer> filterJavaFile(Connection conn, ArrayList<Integer> pageIDList){
		ArrayList<Integer> resultList = new ArrayList<Integer>();
		HashMap<Integer, String> pageIDMapLink = PageDao.getIDMapLink(conn);
		for (int i=0; i<pageIDList.size(); ++i){
			Integer thisID = pageIDList.get(i);
			if (pageIDMapLink.containsKey(thisID)){
				String thisLink = pageIDMapLink.get(thisID);
				if (thisLink.trim().toLowerCase().endsWith(".java")){
					System.out.println(thisLink);
				}else{
					resultList.add(thisID);
				}
			}
		}
		return resultList;
	}
}
